use gen::gen;
use parser::parse;
use std::{
    io::{read_to_string, stdin},
    process::exit,
};

mod ast;
mod gen;
mod parser;

fn main() {
    let input = read_to_string(stdin()).unwrap();
    let ast = parse(&input).unwrap_or_else(|e| {
        eprintln!("{e}");
        exit(1)
    });
    let mut out = String::new();
    gen(&ast, &mut out).unwrap();
    print!("{out}");
}
